package com.yunqing.restkeeper.cash.web.controller;

import com.yunqing.restkeeper.cash.web.vo.LoginVO;
import com.yunqing.restkeeper.common.utils.Result;
import com.yunqing.restkeeper.store.api.service.IStaffService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName LoginController
 * @Description TODO
 * @author: puyunqing
 * @Date: 2025/8/21
 */
@Tag(name = "收银端登录接口")
@RestController
public class LoginController {

    @DubboReference(version = "1.0.0", check = false)
    private IStaffService staffService;

    @Operation(summary = "登录校验")
    @Parameter(name = "Authorization", description = "jwt token", required = false, schema = @Schema(type = "String"), in = ParameterIn.HEADER)
    @PostMapping("/login")
    public Result login(@RequestBody LoginVO loginVO) {
        return staffService.login(loginVO.getShopId(), loginVO.getLoginName(), loginVO.getLoginPass());
    }

}
